// directives/clickOutside.js
export default {
  beforeMount(el: any, binding: any) {
    el.__clickOutsideHandler__ = (event: any) => {
      if (!(el === event.target || el.contains(event.target))) {
        binding.value(event);
      }
    };
    document.addEventListener("click", el.__clickOutsideHandler__);
  },
  unmounted(el: any) {
    document.removeEventListener("click", el.__clickOutsideHandler__);
  },
};
